<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<title>let 命令-禁止变量提升</title> 
<script> 
//使用 var 声明变量 
console.log(x); // undefined 
 var x = 10; 
 //使用 let 声明变量 
 console.log(y); // Cannot access 'y' before initialization 
 let y = 20; 
 </script> 
 </head> 
 <body></body> 
 </html> 